//
//  PlacemanagerTowViewController.m
//  XClassRoom
//
//  Created by NeiQuan on 2016/12/14.
//  Copyright © 2016年 Mr-yuwei. All rights reserved.
//

#import "PlacemanagerTowViewController.h"

@interface PlacemanagerTowViewController ()

@end

@implementation PlacemanagerTowViewController

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{
    self = [super initWithNibName:NSStringFromClass([self.superclass class]) bundle:nibBundleOrNil];
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"修改收货地址";
    if (_model.flag==0) {
        
         [self.switBtn setOn:NO animated:YES];
    }else{
         [self.switBtn setOn:YES animated:YES];
    }
    self.flag=_model.flag;
   
    [self.switBtn addTarget:self action:@selector(getValue1:) forControlEvents:UIControlEventValueChanged];
    self.nameTF.text=_model.userName;
    self.phoneTF.text=_model.phone;
    self.zipCodeTF.text=_model.addr;
    self.cityTF.text=_model.detail;

    // Do any additional setup after loading the view from its nib.
}
-(void)getValue1:(id)sender{
    UISwitch *swi2=(UISwitch *)sender;
    
    if (swi2.isOn) {
        
        NSLog(@"打开");
        self.flag=1;
    }else{
        
        NSLog(@"关上");
        self.flag=0;
        
    }
}
#pragma mark - 保存按钮
-(void)clickrightButton:(UIButton*)btn
{
    [self.nameTF endEditing:YES];
    [self.phoneTF endEditing:YES];
    [self.cityTF endEditing:YES];
    [self.zipCodeTF endEditing:YES];
    
    
   
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
